Debuggability is a feature that is very useful and also necessary to have inside of WebWork.
The config-browser lets you browse through your actions and see your properties and several other information.

But what about seeing the values of your properties or testing your OGNL-expressions against the value stack?

If you like to do that, use the Debugging Interceptor.
It is already implemented in Struts, but I included it into Webwork 2.2.2.

Installing Debuggability

Download the Attachment "Debuggability for WebWork 2.2.2-all files.zip" before following the installing instructions.

1. Add the folder hierarchy "/interceptors/debugging" to your application.

2. Compile the files "DebuggingInterceptor.java" and "PrettyPrintWriter.java", after you have customised the package-path
    inside these two java files to refer to your application' package "/interceptors/debugging".
    Add these files to your package "interceptors.debugging".

3. Add the "console.ftl" (Freemarker-template) to a folder called "templates/freemarker" to the root of your webapplication.
    If you like to put it someplace else you have to change the FreemarkerResult-location-variable in
    DebuggingInterceptor.java (in my application it is done by result.setLocation("/templates/freemarker/console.ftl").)
    Here you should save the place of the console.ftl.

4. Tell the console.ftl the baseUrl to search for its files by defining

var baseUrl = "/yourApplication-Root/templates";

5. Save the following files in /yourApplication-Root/templates:

    - webconsole.css - the stylesheet for the console
    - webconsole.jsp - the jsp to show the console and to make input and outputs available
    - webconsole.js - the javascript-file to make key-events available and to print the results of your inputs

6. Your pom.xml should make freemarker available:

<dependency>
   <groupId>freemarker</groupId>
   <artifactId>freemarker</artifactId>
   <version>2.3.4</version>
</dependency>

7. Your webwork.properties needs to allow debugging by adding the following line:

webwork.devMode=true

8. To use the interceptor, add it to your xwork.xml with a reference:

<interceptor-ref name="debugging" />

9. Declare the interceptor to your application by

<interceptors>
   <interceptor name="debugging" class="com.agimatec.ostium.portlets.observator.interceptors.debugging.DebuggingInterceptor"/>
</interceptors>

 

    (e.g. inside the package-Tag).
    For the class of the interceptor you have - of course - customise the path of the DebuggingInterceptor-class!

If you have any problems or further questions, contact me, Tamara Cattivelli, at [email protected].

Using Debugger

You have several possibilities to use the Debugger, you "installed" right now.

If you like to debug your application/action, just call your action (if you like through the config-browser) and add the debug-parameter to your action query string, by appending "?" and then the value.

value description
debug=xml to get an xml dump of your Action on the page
debug=console to test OGNL expressions against the value stack

example:

http://localhost:8080/mypath/tomy/applicationsaction/myAction.action?debug=console